import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:safetymonitor/app/core/core.dart';

import 'dynamic_trajectory_controller.dart';

///动态轨迹
class DynamicTrajectoryPage extends StatelessWidget {
  DynamicTrajectoryPage({super.key});
  final controller = Get.put(DynamicTrajectoryController());
  @override
  Widget build(BuildContext context) {
    return GetBuilder(
      init: controller,
      initState: (_) {
        controller.initDate();
      },
      builder: (controller) {
        return Scaffold(
          body: Stack(
            children: [
              InAppWebView(
                initialUrlRequest: controller.url,
                onWebViewCreated: (contc){
                  controller.onWebViewCreated(contc);
                },
                onLoadStart: controller.onLoadStart,
                onLoadStop: controller.onLoadStop,
                onConsoleMessage: controller.onConsoleMessage,
              ),
              // FutureBuilder<GetRealtimePersonMonitoringPersonLocationDataDO?>(
              //   future: controller.getRealtimePersonMonitoring(),
              //   builder: (context, snapshot) {
              //     if (snapshot.hasData) {
              //       return ;
              //     } else if (snapshot.connectionState == ConnectionState.done) {
              //       return Center(
              //         child: Column(
              //           mainAxisSize: MainAxisSize.min,
              //           children: [
              //             SvgPicture.asset('assets/svg/zhiban_empty_bg.svg'),
              //             Text(
              //               '暂无内容',
              //               style: TextStyle(
              //                 color: const Color(0xFFC7CEE5),
              //                 fontSize: 14.sp,
              //               ),
              //             ),
              //           ],
              //         ),
              //       );
              //     } else {
              //       // 显示加载指示器
              //       return const Center(child: CircularProgressIndicator());
              //     }
              //   },
              // ),
              Positioned(
                left: 10.w,
                top: 10.w,
                child: IconButton(
                  icon: const Icon(Icons.arrow_back),
                  splashColor: Colors.transparent,
                  highlightColor: Colors.transparent,
                  color: Colors.grey,
                  onPressed: Get.back,
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}
